﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ListAndHashTest
{
    internal class ListDemo
    {
        List<Student> students = new List<Student>();

        public static readonly int size = 5000000;

        public ListDemo() { 
            for(int i=0; i<size; i++)
            {
                students.Add(new Student("n"+(i+1),i+1));
            }
        }

        public Student? getFor(int age)
        {
            for(int i=0;i<size; i++)
            {
                if(students[i].Age != age)
                    continue; 
                return students[i];
            }
            return null;
        }

        public Student? getLambad(int age)
        {
            List<Student> stus = students.Where(o=> o.Age == age).ToList();
            if(stus.Count> 0)
            {
                return stus[0];
            }
            return null;
        }
    }
}
